<?PHP
$d = array(
	'Y' => date('Y'),
	'm' => date('m'),
	'd' => date('d'),
	'H' => 0,
	'M' => 0,
	'S' => 0,
);

$info = true;
foreach($d as $k => $v) {
	if($_GET[$k] != '') {
		$d[$k] = $_GET[$k];
		$info = false;
	}
}

if($info) { ?><pre>
How to use the countdown:

Add your specifications to the URL as GET parameters.
Example: countdown for 31st of march -- ?m=3&amp;d=31
  - Year:    Y (default: this year)
  - Month:   m (default: this month)
  - Day:     d (default: this day)
  - Hour:    H (default: 0)
  - Minutes: M (default: 0)
  - Seconds: S (defualt: 0)

Add flags to the URL as GET parameters without specific values.
Example: countdown tinyurl link for march -- ?m=3&amp;tiny
	tiny   -- Create tinyurl link.

	Comming soon:
	gui -- Graphically create your countdown.
	led -- LED background for countdown

</pre><?PHP exit(); }
if(isset($_GET['tiny'])) {
	echo file_get_contents("http://tinyurl.com/api-create.php?url=http://bennit.be/s/countdown?Y={$d['Y']}&m={$d['m']}&d={$d['d']}&H={$d['H']}&M={$d['M']}&S={$d['S']}");
	exit();
}
?><html>
<head>
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
	<script type="text/javascript" src="/d/countdown/jquery.countdown.js"></script>
	<style type="text/css">@import "/d/countdown/jquery.countdown.css";</style>
</head>
<body>
	<div id="countdown" style="width:300px;"></div>
	<script>
		$(document).ready(function() {
			$('#countdown').countdown({
				until: new Date(<?PHP echo "{$d['Y']},{$d['m']},{$d['d']},{$d['H']},{$d['M']},{$d['S']}"; ?>)
			});
		});
	</script>
</body>
</html>
